<?php
if(!isset($_SESSION)){
	session_start();
}
if(!empty($_SESSION['logind'])){
	header('Location:./index.php');
}
include 'config.php';
if($_SERVER['REQUEST_METHOD'] == 'POST'){
	if(!empty($_POST['username']) && !empty($_POST['password']) && $_POST['username'] == USERNAME && $_POST['password'] == PASSWORD){
		$_SESSION['logind'] = $_POST['username'];
		header('Location:./index.php');
	}else{
		echo '<script>alert("用户名与密码不匹配！");location.href="./login.php";</script>';
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo TITLE;?></title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="js/jquery.js"></script>
<script src="js/cloud.js" type="text/javascript"></script>

<script language="javascript">
	$(function(){
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
	$(window).resize(function(){  
    $('.loginbox').css({'position':'absolute','left':($(window).width()-692)/2});
    })  
});  
</script> 
<script language=javascript>
<!--
function SetFocus()
{
if (document.Login.name.value=="")
	document.Login.name.focus();
}
function CheckForm()
{
	if(document.Login.username.value=="")
	{
		alert("请输入用户名！");
		document.Login.username.focus();
		return false;
	}
	if(document.Login.password.value == "")
	{
		alert("请输入密码！");
		document.Login.password.focus();
		return false;
	}
}
</script>
</head>

<body style="background-color:#1c77ac; background-image:url(images/light.png); background-repeat:no-repeat; background-position:center top; overflow:hidden;">



    <div id="mainBody">
      <div id="cloud1" class="cloud"></div>
      <div id="cloud2" class="cloud"></div>
    </div>  


<div class="logintop">    
    <span>欢迎登录后台管理界面平台</span>      
</div>
    <FORM name=Login action='' method="post" onSubmit="return CheckForm();">
    <div class="loginbody">
    
    <span class="systemlogo"></span> 
       
    <div class="loginbox">
    
    <ul>
    <li><input name="username" type="text" class="loginuser" value="" onclick="JavaScript:this.value=''"/></li>
    <li><input name="password" type="password" class="loginpwd" value="" onclick="JavaScript:this.value=''"/></li>
    <li><input name="submit" type="submit" class="loginbtn" value="登录"  /></li>
    </ul>
    
    
    </div>
    
    </div>
    </form>
    
    
    <div class="loginbm">版权所有  2016 &nbsp;&nbsp; </div>
	
    
</body>

</html>
